-
Notifications
You must be signed in to change notification settings - Fork 127
Decouple repository root resolver from internal logic #2957
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
… and update options in rally and stream runners
…factor tests and added readme note
@mrodm i've updated the code with your feedback. i usually mark resolved the comments that have been addressed, please re-open if you find anything pending. thanks |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks great, it seems to solve links resolution and does a good refactor to allow injection of the path to the root repository.
I did some tests and found some issues, commented in the files, though maybe some of them can be solved in follow ups.
Many comments are nitpicking, no need to do anything about them if you prefer current code.
…use value receiver instead of pointer
… handling in tests
…th to PackageRootPath
…and update related tests
…pdate related tests
…esolve external fields
💚 Build Succeeded
History
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great changes here 👍
// elasticsearch/ingest_pipeline under the provided data stream path. The names | ||
// of the pipelines are decorated with the provided nonce. | ||
func LoadIngestPipelineFiles(dataStreamPath string, nonce int64) ([]Pipeline, error) { | ||
func LoadIngestPipelineFiles(dataStreamPath string, nonce int64, repositoryRoot *os.Root) ([]Pipeline, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if these methods should just receive an FS, instead of receiving the root and creating its own 🤔 For another refactor in any case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, i think there is room for improvement in following refactor. Also i've notice some of the code around the builder, package paths, build paths, etc... that are a bit confusing so perhaps when we work on the feature to allow builds in any target
directory we could have some time to improve that part.
Resolves #2797
Summary
Refactored the linked files system to use explicit
os.Root
parameters for secure repository access. This change fixes a bug where linked files were copied to incorrect directories and reveals a secondary issue where external fields were resolved before linked files were included in the build bundle.Problems Fixed
Linked files copied to wrong directory: The
workDir
inLinksFS
was treated inconsistently (absolute vs relative), causing incorrect path resolution. Now standardized to always be relative to repository root.External fields resolved too early: The build process resolved external fields before copying linked files, causing missing field definitions. Reordered build steps to copy linked files first.
Key Changes
Repository Root Handling:
CreateLinksFSFromPath()
now requires explicit*os.Root
parameterdefer repositoryRoot.Close()
API Changes:
FindPackageRoot()
signature:(string, bool, error)
→(string, error)
ErrPackageRootNotFound
sentinel errorBuildOptions.PackageRoot
renamed toPackageRootPath
and addedRepositoryRoot
fieldOptions.RootPath
renamed toPackageRootPath
and addedRepositoryRoot
fieldBuild Process:
ELASTIC_PACKAGE_REPOSITORY_LICENSE
now expects paths relative to repository rootBreaking Changes
Functions that previously auto-discovered repository root now require it as a parameter:
CreateLinksFSFromPath(repositoryRoot, workDir)
BuildPackage()
requiresRepositoryRoot
in optionsNewForPackage()
requiresRepositoryRoot
in optionsTesting